package com.qqtech.qquan.sys.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.qqtech.core.frame.model.Result;
import com.qqtech.qquan.sys.model.SysAreaVo;
import com.qqtech.qquan.sys.service.SysAreaService;

@Controller
@RequestMapping(value = "/sys/area")
public class SysAreaController extends BaseAdminController {
	@Resource
	private SysAreaService sysAreaService;

	@RequestMapping(value = "/queryProvinceList")
	@ResponseBody
	public Result queryProvinceList(Integer provinceId) {
		Result ret = new Result();
		List<SysAreaVo> list = sysAreaService.findAreaByParent(null);
		ret.put("list", list);
		return ret;
	}

	@RequestMapping(value = "/getCityList")
	@ResponseBody
	public Result getCityList(Integer provinceId) {
		Result ret = new Result();
		List<SysAreaVo> list = sysAreaService.findAreaByParent(provinceId);
		ret.put("list", list);
		return ret;
	}

	@RequestMapping(value = "/getAreaList")
	@ResponseBody
	public Result getAreaList(Integer cityId) {
		Result ret = new Result();
		List<SysAreaVo> list = sysAreaService.findAreaByParent(cityId);
		ret.put("list", list);
		return ret;
	}
}
